package com.pj.wisdomlogistics.ui.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import com.pj.wisdomlogistics.R;
import com.pj.wisdomlogistics.entity.WeekSsMenuInfo;
import com.pj.wisdomlogistics.ui.view.recyclerview.BaseAdapter;
import com.pj.wisdomlogistics.ui.view.recyclerview.BaseViewHolder;
import com.zhy.autolayout.utils.AutoUtils;

/**
 * Created by HelloWorld on 2017/9/11.
 */

public class PopWeekMenuAdapter extends BaseAdapter<WeekSsMenuInfo , BaseViewHolder> {
    public PopWeekMenuAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder createCustomViewHolder(ViewGroup parent, int viewType) {
        return new BaseViewHolder(parent , R.layout.item_pop_ss);
    }

    @Override
    public void bindCustomViewHolder(BaseViewHolder viewHolder, int position) {
        AutoUtils.autoSize(viewHolder.itemView);
        final WeekSsMenuInfo item = getItem(position);

        String week = "";

        switch (position){
            case 0:
                week = "周一";
                break;
            case 1:
                week = "周二";
                break;
            case 2:
                week = "周三";
                break;
            case 3:
                week = "周四";
                break;
            case 4:
                week = "周五";
                break;
            case 5:
                week = "周六";
                break;
            case 6:
                week = "周日";
                viewHolder.getImageView(R.id.iv_line).setVisibility(View.GONE);
                break;
        }
        viewHolder.getTextView(R.id.tv_week).setText(week);
        viewHolder.getTextView(R.id.tv_date).setText("/" + item.getFoodTime());
        viewHolder.getTextView(R.id.tv_ss_1).setText(item.getFoodName1());
        viewHolder.getTextView(R.id.tv_ss_2).setText(item.getFoodName2());
        viewHolder.getTextView(R.id.tv_ss_3).setText(item.getFoodName3());
    }

    @Override
    public int getCustomViewType(int position) {
        return 0;
    }
}
